﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using HXu.BaseTools;

namespace HXu.ToolTest
{
    public class TestOfColorTools : MonoBehaviour
    {
        string redRGB = "#FF0000";
        string redRGBA = "#FF0000FF";

        void Start()
        {
            redRGB.RegularMatch(ColorTools.hexColorRegex).Log();//True

            redRGBA.RegularMatch(ColorTools.hexColorRegex).Log();//True

            Color.red.ColorToHex(ColorTools.ColorType.RRGGBB).Log();//#FF0000

            Color.red.ColorToHex(ColorTools.ColorType.RRGGBBAA).Log();//#FF0000FF

            if (redRGB.HexToColor(out Color color))
            {
                color.Log();//RGBA(1.000, 0.000, 0.000, 1.000)
            };
        }
    }
}
